/*
 * @Author: WangXiao
 * @Date: 2021-04-08 20:47:39
 * @LastEditTime: 2021-04-16 18:27:10
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /dvr-ui/src/methods/videoPlay.js
 */

/**
 * @description: 点击文件叉子后移除文件进行的动作
 * @param {*} file
 * @param {*} fileList
 * @return {*}
 */
let handleRemoveI = function (file, fileList) {
  console.log(file, fileList);
}
/**
 * @description: 点击文件时调用的钩子
 * @param {*} file
 * @return {*}
 */
let handlePreviewI = function (file) {
  console.log(file);
}

/**
 * @description:  超过所选数
 * @param {*} files
 * @param {*} fileList
 * @return {*}
 */
let handleExceedI = function (files, fileList) {
  this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
}
/**
 * @description : 成功钩子
 * @param {*} file 
 * @param {*} fileList 
 * @returns {*}
 */
let handleSuccessI = function (response, file, fileList) {
  console.log(response, file, fileList)
}
/**
 * 
 * @param {*} file 
 * @param {*} fileList 
 */
let handleErrorI = function (err, file, fileList) {
  console.log(err, file, fileList)
}
/**
 * 
 * @description 上传图片时判断是否为图片
 * @param {*} file 
 * @param {*} fileList 
 */
let handleBeforeUploadI = function (file) {
  let arr = file.name.split(".")
  let fileType = arr[arr.length - 1];
  if (fileType != "bmp" &
    fileType != "jpg" &
    fileType != "png" &
    fileType != "tif" &
    fileType != "gif"
  ) {
    this.$alert('只支持上传bmp,jpg,png,tif,gif格式的图片', '错误', {
      confirmButtonText: '确定',
      callback: () => {
        this.$notify.error({
          title: '错误',
          message: '上传失败'
        });
      }
    });
    return false;
  }
}
export { handleRemoveI, handlePreviewI, handleExceedI, handleSuccessI, handleErrorI, handleBeforeUploadI }